//6:输入一个整数，判断是否是质数（定义是只能被1和自身整除的数，比如3，7，2等）
package ZUOYE0421;

import java.util.Scanner;

public class 更改作业6 {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		System.out.println("输入一个数：");
		int num = in.nextInt();
		boolean b = true;
		for (int a = 2; a * a <= num; a++) {
			if (num % a == 0) {
				System.out.println(num + "不为质数");
				b = false;
				break;
			}
		}
		if (b == true) {
			System.out.println(num + "为质数");
		}
	}
}
